package kr.hkit.androidcomplete02.ch12;

import java.util.ArrayList;

import kr.hkit.androidcomplete02.R;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class ListActivityEx extends ListActivity {
	ArrayAdapter<CharSequence> arrayAdapter;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		arrayAdapter = ArrayAdapter.createFromResource(this, R.array.country,
				android.R.layout.simple_list_item_1);
		
		setListAdapter(arrayAdapter);
		
	}

	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		String text = "Select Item = " + arrayAdapter.getItem(position);
		Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
	}
	
	
}
